package top.yuyufeng.mbuy.enums;

/**
 * 使用枚举表诉常量数据字段
 */
public enum PayPlatformEnum {
    ALI_PAY(1, "支付宝"),
    WX_PAY(2, "微信");

    private int key;

    private String value;

    PayPlatformEnum(int key, String value) {
        this.key = key;
        this.value = value;
    }

    public int getKey() {
        return key;
    }

    public String getValue() {
        return value;
    }

    public static PayPlatformEnum valueOf(int index) {
        for (PayPlatformEnum e : values()) {
            if (e.getKey() == index) {
                return e;
            }
        }
        return null;
    }
}
